import { FIVE_ELEMENT, type FiveElement } from '../../constants/five-elements';
import { ConditionFactory } from '../../systems/condition-checker/factory';
import { ITEM_ID } from '../item';
import type { SpiritualRootConfig } from './type';

export const SPIRITUAL_ROOT_LEVEL_DESC_MAP: Record<number, string> = {
  0: '废灵根',
  1: '枯木级',
  2: '锈铁级',
  3: '杂石级',
  4: '露芽级',
  5: '青芽级',
  6: '玉芽级',
  7: '幽苗级',
  8: '星苗级',
  9: '月苗级',
  10: '灵枝级',
  11: '玄枝级',
  12: '圣枝级',
  13: '一叶级',
  14: '三叶级',
  15: '七叶级',
  16: '初花级',
  17: '盛花级',
  18: '灵花级',
  19: '金蕊级',
  20: '紫蕊级',
  21: '道蕊级',
  22: '灵胎级',
  23: '圣胎级',
  24: '道胎级',
  25: '混元级',
  26: '无极级',
  27: '太初级',
};

export const SPIRITUAL_ROOT: Record<FiveElement, SpiritualRootConfig> = {
  [FIVE_ELEMENT.METAL]: {
    type: FIVE_ELEMENT.METAL,
    levels: [
      // 0~5
      {
        upgradeConditions: [],
        cultivationSpeed: 0,
      },
      {
        upgradeConditions: [],
        cultivationSpeed: 0.1,
      },
      {
        upgradeConditions: [],
        cultivationSpeed: 0.2,
      },
      {
        upgradeConditions: [],
        cultivationSpeed: 0.3,
      },
      {
        upgradeConditions: [],
        cultivationSpeed: 0.4,
      },
      {
        upgradeConditions: [],
        cultivationSpeed: 0.5,
      },
      // 6~10
      {
        upgradeConditions: [],
        cultivationSpeed: 0.6,
      },
      {
        upgradeConditions: [],
        cultivationSpeed: 0.7,
      },
      {
        upgradeConditions: [],
        cultivationSpeed: 0.8,
      },
      {
        upgradeConditions: [],
        cultivationSpeed: 0.9,
      },
      {
        upgradeConditions: [],
        cultivationSpeed: 1,
      },
      // 11~15
      {
        upgradeConditions: [],
        cultivationSpeed: 1.05,
      },
      {
        upgradeConditions: [],
        cultivationSpeed: 1.1,
      },
      {
        upgradeConditions: [],
        cultivationSpeed: 1.15,
      },
      {
        upgradeConditions: [],
        cultivationSpeed: 1.2,
      },
      {
        upgradeConditions: [],
        cultivationSpeed: 1.25,
      },
      // 16~20
      {
        upgradeConditions: [],
        cultivationSpeed: 1.3,
      },
      {
        upgradeConditions: [],
        cultivationSpeed: 1.35,
      },
      {
        upgradeConditions: [],
        cultivationSpeed: 1.4,
      },
      {
        upgradeConditions: [],
        cultivationSpeed: 1.45,
      },
      {
        upgradeConditions: [],
        cultivationSpeed: 1.5,
      },
      // 21~25
      {
        upgradeConditions: [],
        cultivationSpeed: 1.55,
      },
      {
        upgradeConditions: [],
        cultivationSpeed: 1.6,
      },
      {
        upgradeConditions: [],
        cultivationSpeed: 1.65,
      },
      {
        upgradeConditions: [],
        cultivationSpeed: 1.7,
      },
      {
        upgradeConditions: [],
        cultivationSpeed: 1.75,
      },
      // 26~30
      {
        upgradeConditions: [],
        cultivationSpeed: 1.8,
      },
      {
        upgradeConditions: [],
        cultivationSpeed: 2,
      },
      {
        upgradeConditions: [],
        cultivationSpeed: 2.5,
      },
      {
        upgradeConditions: [],
        cultivationSpeed: 3,
      },
      {
        upgradeConditions: [],
        cultivationSpeed: 4,
      },
    ],
  },
  [FIVE_ELEMENT.WOOD]: {
    type: FIVE_ELEMENT.WOOD,
    levels: [
      // 0~5
      {
        upgradeConditions: [
          ConditionFactory.createItemCondition(ITEM_ID.TAI_CHU_CUI_LU, 100),
        ],
        cultivationSpeed: 0,
      },
      {
        upgradeConditions: [],
        cultivationSpeed: 0.1,
      },
      {
        upgradeConditions: [],
        cultivationSpeed: 0.2,
      },
      {
        upgradeConditions: [],
        cultivationSpeed: 0.3,
      },
      {
        upgradeConditions: [],
        cultivationSpeed: 0.4,
      },
      {
        upgradeConditions: [],
        cultivationSpeed: 0.5,
      },
      // 6~10
      {
        upgradeConditions: [],
        cultivationSpeed: 0.6,
      },
      {
        upgradeConditions: [],
        cultivationSpeed: 0.7,
      },
      {
        upgradeConditions: [],
        cultivationSpeed: 0.8,
      },
      {
        upgradeConditions: [],
        cultivationSpeed: 0.9,
      },
      {
        upgradeConditions: [],
        cultivationSpeed: 1,
      },
      // 11~15
      {
        upgradeConditions: [],
        cultivationSpeed: 1.05,
      },
      {
        upgradeConditions: [],
        cultivationSpeed: 1.1,
      },
      {
        upgradeConditions: [],
        cultivationSpeed: 1.15,
      },
      {
        upgradeConditions: [],
        cultivationSpeed: 1.2,
      },
      {
        upgradeConditions: [],
        cultivationSpeed: 1.25,
      },
      // 16~20
      {
        upgradeConditions: [],
        cultivationSpeed: 1.3,
      },
      {
        upgradeConditions: [],
        cultivationSpeed: 1.35,
      },
      {
        upgradeConditions: [],
        cultivationSpeed: 1.4,
      },
      {
        upgradeConditions: [],
        cultivationSpeed: 1.45,
      },
      {
        upgradeConditions: [],
        cultivationSpeed: 1.5,
      },
      // 21~25
      {
        upgradeConditions: [],
        cultivationSpeed: 1.55,
      },
      {
        upgradeConditions: [],
        cultivationSpeed: 1.6,
      },
      {
        upgradeConditions: [],
        cultivationSpeed: 1.65,
      },
      {
        upgradeConditions: [],
        cultivationSpeed: 1.7,
      },
      {
        upgradeConditions: [],
        cultivationSpeed: 1.75,
      },
      // 26~30
      {
        upgradeConditions: [],
        cultivationSpeed: 1.8,
      },
      {
        upgradeConditions: [],
        cultivationSpeed: 2,
      },
      {
        upgradeConditions: [],
        cultivationSpeed: 2.5,
      },
      {
        upgradeConditions: [],
        cultivationSpeed: 3,
      },
      {
        upgradeConditions: [],
        cultivationSpeed: 4,
      },
    ],
  },
  [FIVE_ELEMENT.WATER]: {
    type: FIVE_ELEMENT.WATER,
    levels: [
      // 0~5
      {
        upgradeConditions: [],
        cultivationSpeed: 0,
      },
      {
        upgradeConditions: [],
        cultivationSpeed: 0.1,
      },
      {
        upgradeConditions: [],
        cultivationSpeed: 0.2,
      },
      {
        upgradeConditions: [],
        cultivationSpeed: 0.3,
      },
      {
        upgradeConditions: [],
        cultivationSpeed: 0.4,
      },
      {
        upgradeConditions: [],
        cultivationSpeed: 0.5,
      },
      // 6~10
      {
        upgradeConditions: [],
        cultivationSpeed: 0.6,
      },
      {
        upgradeConditions: [],
        cultivationSpeed: 0.7,
      },
      {
        upgradeConditions: [],
        cultivationSpeed: 0.8,
      },
      {
        upgradeConditions: [],
        cultivationSpeed: 0.9,
      },
      {
        upgradeConditions: [],
        cultivationSpeed: 1,
      },
      // 11~15
      {
        upgradeConditions: [],
        cultivationSpeed: 1.05,
      },
      {
        upgradeConditions: [],
        cultivationSpeed: 1.1,
      },
      {
        upgradeConditions: [],
        cultivationSpeed: 1.15,
      },
      {
        upgradeConditions: [],
        cultivationSpeed: 1.2,
      },
      {
        upgradeConditions: [],
        cultivationSpeed: 1.25,
      },
      // 16~20
      {
        upgradeConditions: [],
        cultivationSpeed: 1.3,
      },
      {
        upgradeConditions: [],
        cultivationSpeed: 1.35,
      },
      {
        upgradeConditions: [],
        cultivationSpeed: 1.4,
      },
      {
        upgradeConditions: [],
        cultivationSpeed: 1.45,
      },
      {
        upgradeConditions: [],
        cultivationSpeed: 1.5,
      },
      // 21~25
      {
        upgradeConditions: [],
        cultivationSpeed: 1.55,
      },
      {
        upgradeConditions: [],
        cultivationSpeed: 1.6,
      },
      {
        upgradeConditions: [],
        cultivationSpeed: 1.65,
      },
      {
        upgradeConditions: [],
        cultivationSpeed: 1.7,
      },
      {
        upgradeConditions: [],
        cultivationSpeed: 1.75,
      },
      // 26~30
      {
        upgradeConditions: [],
        cultivationSpeed: 1.8,
      },
      {
        upgradeConditions: [],
        cultivationSpeed: 2,
      },
      {
        upgradeConditions: [],
        cultivationSpeed: 2.5,
      },
      {
        upgradeConditions: [],
        cultivationSpeed: 3,
      },
      {
        upgradeConditions: [],
        cultivationSpeed: 4,
      },
    ],
  },
  [FIVE_ELEMENT.FIRE]: {
    type: FIVE_ELEMENT.FIRE,
    levels: [
      // 0~5
      {
        upgradeConditions: [],
        cultivationSpeed: 0,
      },
      {
        upgradeConditions: [],
        cultivationSpeed: 0.1,
      },
      {
        upgradeConditions: [],
        cultivationSpeed: 0.2,
      },
      {
        upgradeConditions: [],
        cultivationSpeed: 0.3,
      },
      {
        upgradeConditions: [],
        cultivationSpeed: 0.4,
      },
      {
        upgradeConditions: [],
        cultivationSpeed: 0.5,
      },
      // 6~10
      {
        upgradeConditions: [],
        cultivationSpeed: 0.6,
      },
      {
        upgradeConditions: [],
        cultivationSpeed: 0.7,
      },
      {
        upgradeConditions: [],
        cultivationSpeed: 0.8,
      },
      {
        upgradeConditions: [],
        cultivationSpeed: 0.9,
      },
      {
        upgradeConditions: [],
        cultivationSpeed: 1,
      },
      // 11~15
      {
        upgradeConditions: [],
        cultivationSpeed: 1.05,
      },
      {
        upgradeConditions: [],
        cultivationSpeed: 1.1,
      },
      {
        upgradeConditions: [],
        cultivationSpeed: 1.15,
      },
      {
        upgradeConditions: [],
        cultivationSpeed: 1.2,
      },
      {
        upgradeConditions: [],
        cultivationSpeed: 1.25,
      },
      // 16~20
      {
        upgradeConditions: [],
        cultivationSpeed: 1.3,
      },
      {
        upgradeConditions: [],
        cultivationSpeed: 1.35,
      },
      {
        upgradeConditions: [],
        cultivationSpeed: 1.4,
      },
      {
        upgradeConditions: [],
        cultivationSpeed: 1.45,
      },
      {
        upgradeConditions: [],
        cultivationSpeed: 1.5,
      },
      // 21~25
      {
        upgradeConditions: [],
        cultivationSpeed: 1.55,
      },
      {
        upgradeConditions: [],
        cultivationSpeed: 1.6,
      },
      {
        upgradeConditions: [],
        cultivationSpeed: 1.65,
      },
      {
        upgradeConditions: [],
        cultivationSpeed: 1.7,
      },
      {
        upgradeConditions: [],
        cultivationSpeed: 1.75,
      },
      // 26~30
      {
        upgradeConditions: [],
        cultivationSpeed: 1.8,
      },
      {
        upgradeConditions: [],
        cultivationSpeed: 2,
      },
      {
        upgradeConditions: [],
        cultivationSpeed: 2.5,
      },
      {
        upgradeConditions: [],
        cultivationSpeed: 3,
      },
      {
        upgradeConditions: [],
        cultivationSpeed: 4,
      },
    ],
  },
  [FIVE_ELEMENT.EARTH]: {
    type: FIVE_ELEMENT.EARTH,
    levels: [
      // 0~5
      {
        upgradeConditions: [],
        cultivationSpeed: 0,
      },
      {
        upgradeConditions: [],
        cultivationSpeed: 0.1,
      },
      {
        upgradeConditions: [],
        cultivationSpeed: 0.2,
      },
      {
        upgradeConditions: [],
        cultivationSpeed: 0.3,
      },
      {
        upgradeConditions: [],
        cultivationSpeed: 0.4,
      },
      {
        upgradeConditions: [],
        cultivationSpeed: 0.5,
      },
      // 6~10
      {
        upgradeConditions: [],
        cultivationSpeed: 0.6,
      },
      {
        upgradeConditions: [],
        cultivationSpeed: 0.7,
      },
      {
        upgradeConditions: [],
        cultivationSpeed: 0.8,
      },
      {
        upgradeConditions: [],
        cultivationSpeed: 0.9,
      },
      {
        upgradeConditions: [],
        cultivationSpeed: 1,
      },
      // 11~15
      {
        upgradeConditions: [],
        cultivationSpeed: 1.05,
      },
      {
        upgradeConditions: [],
        cultivationSpeed: 1.1,
      },
      {
        upgradeConditions: [],
        cultivationSpeed: 1.15,
      },
      {
        upgradeConditions: [],
        cultivationSpeed: 1.2,
      },
      {
        upgradeConditions: [],
        cultivationSpeed: 1.25,
      },
      // 16~20
      {
        upgradeConditions: [],
        cultivationSpeed: 1.3,
      },
      {
        upgradeConditions: [],
        cultivationSpeed: 1.35,
      },
      {
        upgradeConditions: [],
        cultivationSpeed: 1.4,
      },
      {
        upgradeConditions: [],
        cultivationSpeed: 1.45,
      },
      {
        upgradeConditions: [],
        cultivationSpeed: 1.5,
      },
      // 21~25
      {
        upgradeConditions: [],
        cultivationSpeed: 1.55,
      },
      {
        upgradeConditions: [],
        cultivationSpeed: 1.6,
      },
      {
        upgradeConditions: [],
        cultivationSpeed: 1.65,
      },
      {
        upgradeConditions: [],
        cultivationSpeed: 1.7,
      },
      {
        upgradeConditions: [],
        cultivationSpeed: 1.75,
      },
      // 26~30
      {
        upgradeConditions: [],
        cultivationSpeed: 1.8,
      },
      {
        upgradeConditions: [],
        cultivationSpeed: 2,
      },
      {
        upgradeConditions: [],
        cultivationSpeed: 2.5,
      },
      {
        upgradeConditions: [],
        cultivationSpeed: 3,
      },
      {
        upgradeConditions: [],
        cultivationSpeed: 4,
      },
    ],
  },
};
